package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    //登录验证
    @Select(" select * from employee where username = #{username} ")
    Employee login( Employee employee );

    //添加员工
    @Insert("INSERT INTO employee VALUES ( null , #{name} , #{username} , #{password} , #{phone} , #{sex} , " +
            " #{idNumber} , #{status} , #{createTime} ,  #{updateTime} , #{createUser} , #{updateUser});")
    void add(Employee employee);

    //查看列表
    List<Employee> page(String name);

    //编辑员工状态
    void updateStatus(Employee employee);

    @Select("SELECT * FROM employee where id = #{id}")
    Employee findById(Long id);
}
